package com.example.demoproducer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class HelloController {
    @Value("${server.port}")
    private String port;
    private volatile double count = 0d;

    @GetMapping("/hello")
    public String getRequest(){
        synchronized (this){
            count++;
            log.info("This controller has been used " + count);
        }
        return "Hello, this message come from port " + port;
    }
}
